﻿<%@ Page Language="C#" MasterPageFile="~/PresentationLayer/Split.Master" AutoEventWireup="true" CodeBehind="VerPerc.aspx.cs" Inherits="Distrackting.PresentationLayer.VerPerc" Title="Distrackting: Percurso" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="side" runat="server">
<div class="border box small">
<h2><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></h2>
<ul>
<li><asp:HyperLink ID="HyperLink4" runat="server">Ficha técnica</asp:HyperLink></li>
<li><asp:HyperLink ID="HyperLink1" runat="server">Mapa</asp:HyperLink></li>
<li><asp:HyperLink ID="HyperLink2" runat="server">Fotos</asp:HyperLink></li>
<li><asp:HyperLink ID="HyperLink3" runat="server">Testemunhos</asp:HyperLink></li> 
</ul>
</div>

<div class="blank"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="rest" runat="server">
<div class="large box border">
    <asp:Label ID="Label22" runat="server" Text="FICHA TÉCNICA" Font-Bold="True"></asp:Label>
    <asp:DetailsView ID="DetailsVerPercursos" runat="server" Height="50px" 
        Width="347px" AutoGenerateRows="False" 
        DataSourceID="ObjectDataSource_GetPercurso" style="margin-right: 37px" 
        CellPadding="4" ForeColor="#333333" GridLines="None">
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
        <RowStyle BackColor="#E3EAEB" />
        <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <Fields>
            <asp:TemplateField HeaderText="Nome" SortExpression="nome">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("nome") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("nome") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Partida" SortExpression="localidade">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("Localidade1.nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("cod_partida") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("cod_partida") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Chegada" SortExpression="cod_chegada">
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("Localidade.nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Localidade") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Localidade") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Distância (km)" SortExpression="distancia">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("distancia") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("distancia") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("distancia") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Duração (min)" SortExpression="duracao">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("duracao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("duracao") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("duracao") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Dificuldade" SortExpression="cod_dificuldade">
                <ItemTemplate>
                    <asp:Label ID="Label11" runat="server" 
                        Text='<%# Eval("Dificuldade.descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("Dificuldade") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("Dificuldade") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Desnível" SortExpression="cod_desnivel">
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("Desnivel.descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("Desnivel") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("Desnivel") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Época" SortExpression="cod_epoca">
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Eval("Epoca.epoca") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Epoca") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Epoca") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Âmbito" SortExpression="cod_ambito">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Eval("Ambito.descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Ambito") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Ambito") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Entidade Responsável" 
                SortExpression="cod_entidade">
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" 
                        Text='<%# Eval("Entidade_responsavel.nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox9" runat="server" 
                        Text='<%# Bind("Entidade_responsavel") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox9" runat="server" 
                        Text='<%# Bind("Entidade_responsavel") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Estado" SortExpression="cod_estado">
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server" 
                        Text='<%# Eval("Estado_percurso.descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox10" runat="server" 
                        Text='<%# Bind("Estado_percurso") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox10" runat="server" 
                        Text='<%# Bind("Estado_percurso") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tipo" SortExpression="cod_tipo">
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server" 
                        Text='<%# Eval("Tipo_percurso.descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("Tipo_percurso") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("Tipo_percurso") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Descrição" SortExpression="descricao">
                <ItemTemplate>
                    <asp:Label ID="Label13" runat="server" Text='<%# Bind("descricao") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("descricao") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("descricao") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Data" SortExpression="data">
                <ItemTemplate>
                    <asp:Label ID="Label14" runat="server" Text='<%# Bind("data") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox14" runat="server" Text='<%# Bind("data") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox14" runat="server" Text='<%# Bind("data") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Rating" SortExpression="rating_total">
                <ItemTemplate>
                    <asp:Label ID="Label15" runat="server" Text='<%# Bind("rating_total") %>'></asp:Label>
                    <asp:Image ID="Image1" runat="server" 
                        ImageUrl="~/PresentationLayer/Images/rate_star_25x23.png" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox15" runat="server" Text='<%# Bind("rating_total") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox15" runat="server" Text='<%# Bind("rating_total") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Downloads" SortExpression="descarregado">
                <ItemTemplate>
                    <asp:Label ID="Label17" runat="server" Text='<%# Bind("descarregado") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox17" runat="server" Text='<%# Bind("descarregado") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox17" runat="server" Text='<%# Bind("descarregado") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Adicionado Por" SortExpression="cod_utilizador">
                <ItemTemplate>
                    <asp:Label ID="Label16" runat="server" Text='<%# Eval("Utilizador.nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox16" runat="server" Text='<%# Bind("cod_utilizador") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox16" runat="server" Text='<%# Bind("cod_utilizador") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
        </Fields>
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#7C6F57" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
    <br />
    <asp:Button ID="Button8" runat="server" onclick="Button8_Click" 
        Text="Remover Percurso" Visible="False" />
    <br />
    <br />
    <asp:Button ID="Button4" runat="server" Text="Marcar Percurso Futuro" 
        onclick="Button4_Click" />
    <br />
    <br />
    <asp:Button ID="Button5" runat="server" Text="Desmarcar Percurso Futuro" 
        onclick="Button5_Click" />
    </div>
    <div class="blank"></div>
<div class="large box border">
    <asp:Label ID="LabelTestemunho" runat="server" Font-Bold="True" 
        Text="Escreva o seu testemunho :"></asp:Label>
    <br />
    <asp:TextBox ID="TextBox18" runat="server" TextMode="MultiLine" Height="84px" 
        Width="350px"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="Label19" runat="server" Text="Rating"></asp:Label>
    <br />
    <asp:DropDownList ID="DropDownRating" runat="server">
        <asp:ListItem>1</asp:ListItem>
        <asp:ListItem>2</asp:ListItem>
        <asp:ListItem>3</asp:ListItem>
        <asp:ListItem>4</asp:ListItem>
        <asp:ListItem>5</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <asp:Button ID="Button6" runat="server" onclick="Button6_Click" 
        Text="Submeter testemunho" />
    <asp:ObjectDataSource ID="ObjectDataSource_GetPercurso" runat="server" 
        SelectMethod="getPercurso" TypeName="Distrackting.BusinessLayer.GerirPercursos">
        <SelectParameters>
            <asp:QueryStringParameter Name="cod_perc" QueryStringField="perc" 
                Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
</div>
<div class="blank"></div>
<div class="large box border">
     <asp:Label ID="Label20" runat="server" Font-Bold="True" Font-Overline="False" 
         Text="COMENTÁRIOS"></asp:Label>
     <br />
     <br />
     <asp:DetailsView ID="DetailsView_Comentarios" runat="server" Height="50px" 
        Width="348px" AutoGenerateRows="False" 
        DataSourceID="ObjectDataSource_Comentarios" AllowPaging="True" 
         CellPadding="4" ForeColor="#333333" GridLines="None">
         <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
         <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
         <RowStyle BackColor="#E3EAEB" />
         <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
         <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <Fields>
            <asp:TemplateField HeaderText="Utilizador" SortExpression="cod_utilizador">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Utilizador.nome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("cod_utilizador") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("cod_utilizador") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Data" SortExpression="data">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("data") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("data") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("data") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Comentário" SortExpression="texto">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("texto") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("texto") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("texto") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
        </Fields>
         <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
         <EditRowStyle BackColor="#7C6F57" />
         <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
    <br />
    <asp:Label ID="Label18" runat="server" Text="Escreva aqui o seu comentário"></asp:Label>
     :<br />
    <asp:TextBox ID="TextBoxComentario" runat="server" style="margin-bottom: 0px" 
        TextMode="MultiLine" Height="84px" Width="350px"></asp:TextBox>
     <br />
    <br />
    <asp:Button ID="ButtonComentario" runat="server" 
        onclick="ButtonComentario_Click" Text="Adicionar comentário" />
    <br />
    <asp:ObjectDataSource ID="ObjectDataSource_Comentarios" runat="server" 
        SelectMethod="getComentariosByPercurso" 
        TypeName="Distrackting.BusinessLayer.GerirPercursos">
        <SelectParameters>
            <asp:QueryStringParameter Name="cod_perc" QueryStringField="perc" 
                Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </div>
    <div class="blank"></div>
<div class="large box border">
    <asp:Label ID="Label21" runat="server" Text=" FICHEIRO GPX" Font-Bold="True"></asp:Label>
    <br />
    <br />
    <asp:FileUpload ID="FileUpload1" runat="server" />    
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
        Text="Download Ficheiro GPS" />
    <br />
    (Escolha um ficheiro qualquer da pasta  <br />
    &nbsp;onde pretende armazenar o ficheiro GPS)</div>
</asp:Content>
